import request from '@/utils/request'

/**
 * 统一下单-单个商品
 */
export function payCreateOrderAPI(params) {
  return request({
    url: 'adminPay/createOrder',
    method: 'post',
    data: params,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 统一下单-多商品
 */
export function payCreateOrderMultiAPI(params) {
  return request({
    url: 'adminPay/createOrderMulti',
    method: 'post',
    data: params,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 获取订单历表
 * @param {*} params
 */
export function payGetOrderListAPI(params) {
  return request({
    url: 'adminPay/getOrderList',
    method: 'post',
    data: params,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 取消订单
 * @param {*} params
 */
export function payCloseOrderAPI(params) {
  return request({
    url: `adminPay/closeOrder/${params}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 支付订单结果查询
 * @param {*} params
 */
export function payQueryOrderAPI(params) {
  return request({
    url: '/adminPay/queryOrder',
    method: 'post',
    data: params,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 获取是未支付的订单
 */
export function payGetNotPaidOrderByGoodsIdAPI(goodsId) {
  return request({
    url: '/adminPay/getNotPaidOrderByGoodsId',
    method: 'post',
    data: { goodsId }
  })
}

/**
 * @description: 计算所需金钱
 * @param {*}
 * @return {*}
 */

export function payCalculateMoneyAPI(data) {
  return request({
    url: `/adminPay/calculateMoney`,
    method: 'post',
    data
  })
}

/**
 * @description: 获取套餐list
 * @param {*}
 * @return {*}
 */

export function payQueryComboListAPI() {
  return request({
    url: `/adminPay/queryCombo`,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * @description: 获取企业当前所处套餐
 * @param {*}
 * @return {*}
 */

export function paQueryInUseGoodsIdAPI() {
  return request({
    url: `/adminPay/queryInUseGoodsId`,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/*
 * @description: 获取未支付的订单数量
 * @param {*}
 * @return {*}
 */
export function payGetPaidNumberAPI() {
  return request({
    url: `adminPay/queryNotPaidOrderCount`,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * @description: 试用7天
 * @param {*} data
 * @return {*}
 */
export function payTryUseModuleListAPI(data) {
  return request({
    url: '/adminPay/tryUseModuleList',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data
  })
}
